Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid treating \ as escape char on Windows #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

radeksimko
Copy link
Contributor

Fixes #38

While this is probably not a perfect solution, I think it makes a good start as it makes all tests pass on Windows and fixes the most common issue when \ paths are used in the input.

I originally wanted to implement proper escaping for Windows too, but then I realized it would be a little more complex and I thought this is already a progress. 🤷‍♂️

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2020

Codecov Report

Merging #39 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #39   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          143       145    +2     
=========================================
+ Hits           143       145    +2     
Impacted Files Coverage Δ
shellwords.go 100.00% <100.00%> (ø)
util_posix.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28e4fdf...74d265b. Read the comment docs.

@mattn
Copy link
Owner

mattn commented Aug 28, 2020

it is not good that isEscapeRune always return false.

@radeksimko
Copy link
Contributor Author

I agree @mattn - as I mentioned above this is rather simple solution which is just addressing the known \ case.

I can look into more complete solution, but I expect it to be much more complex than this, because escaping on Windows seems to be more context-dependent, so it's not as simple as declaring a single rune as escape character I'm afraid, unless I misread the available docs on this. Also escaping behaviours may differ between cmd.exe and PowerShell.

Either way if you are willing to review/discuss better Windows support I can look into it.

@caarlos0
Copy link

Hey, how can I help getting this merged in? We have a replace in our go.mod for almost a year now 😬

refs goreleaser/goreleaser#2080

@jamestiotio
Copy link

Hi @mattn @radeksimko, any plans on moving this PR forward? Seems like someone over at #38 have confirmed that this fix works. Would be great to have this feature in this package!

@caarlos0
Copy link

caarlos0 commented Nov 21, 2022

@jamestiotio I've been using a fork in @goreleaser for a while now: https://github.com/caarlos0/go-shellwords

It would be nicer if @mattn could merge this though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Parse function removes needed backslashes
5 participants